<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        /* 
        可以拷贝函数，正则，undefined
        缺点：二级对象只能实现浅拷贝
         */
        let obj1 = {
            name: 'yyg',
            age: 34,
            say() {
                console.log(1)
            },
            person: {
                a: 1
            }
        }
        // let obj2=obj1;true
        let obj2 = {
            address: 'kunming'
        }
        let obj = Object.assign(obj2, obj1)
        obj1.name = 'qwer';
        obj1.person.a = 2
        console.log(obj2)
        console.log(obj1)
        // console.log(obj===obj2)true

    </script>
</body>

</html>